{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tensorflow.keras.datasets import imdb"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "(train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "1"
     },
     "metadata": {},
     "execution_count": 3
    }
   ],
   "source": [
    "1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "1"
     },
     "metadata": {},
     "execution_count": 4
    }
   ],
   "source": [
    "train_labels[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/imdb_word_index.json\n1646592/1641221 [==============================] - 2s 1us/step\n"
    }
   ],
   "source": [
    "word_index = imdb.get_word_index()\n",
    "reverse_word_index = dict([(value, key) for (key, value) in word_index.items()])\n",
    "decoded_review = ' '.join([reverse_word_index.get(i-3, '?') for i in train_data[0]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "\"? this film was just brilliant casting location scenery story direction everyone's really suited the part they played and you could just imagine being there robert ? is an amazing actor and now the same being director ? father came from the same scottish island as myself so i loved the fact there was a real connection with this film the witty remarks throughout the film were great it was just brilliant so much that i bought the film as soon as it was released for ? and would recommend it to everyone to watch and the fly fishing was amazing really cried at the end it was so sad and you know what they say if you cry at a film it must have been good and this definitely was also ? to the two little boy's that played the ? of norman and paul they were just brilliant children are often left out of the ? list i think because the stars that play them all grown up are such a big profile for the whole film but these children are amazing and should be praised for what they have done don't you think the whole story was so lovely because it was true and was someone's life after all that was shared with us all\""
     },
     "metadata": {},
     "execution_count": 6
    }
   ],
   "source": [
    "decoded_review"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "def vectorize_sequences(sequences, dimension=10000):\n",
    "    results = np.zeros((len(sequences), dimension))\n",
    "    for i, sequences in enumerate(sequences):\n",
    "        results[i, sequences] = 1.\n",
    "    return results\n",
    "\n",
    "x_train = vectorize_sequences(train_data)\n",
    "x_test = vectorize_sequences(test_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0., 1., 1., ..., 0., 0., 0.])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_train[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_train = np.asarray(train_labels).astype('float32')\n",
    "y_test = np.asarray(test_labels).astype('float32')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tensorflow.keras import models, layers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = models.Sequential()\n",
    "model.add(layers.Dense(16, activation='relu', input_shape=(10000,)))\n",
    "model.add(layers.Dense(16, activation='relu'))\n",
    "model.add(layers.Dense(1, activation='sigmoid'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_val = x_train[:10000]\n",
    "partial_x_train = x_train[10000:]\n",
    "y_val = y_train[:10000]\n",
    "partial_y_train = y_train[10000:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train on 15000 samples, validate on 10000 samples\n",
      "Epoch 1/20\n",
      "15000/15000 [==============================] - 3s 224us/sample - loss: 0.5305 - accuracy: 0.7827 - val_loss: 0.4050 - val_accuracy: 0.8646\n",
      "Epoch 2/20\n",
      "15000/15000 [==============================] - 2s 161us/sample - loss: 0.3218 - accuracy: 0.8990 - val_loss: 0.3114 - val_accuracy: 0.8881\n",
      "Epoch 3/20\n",
      "15000/15000 [==============================] - 2s 142us/sample - loss: 0.2336 - accuracy: 0.9259 - val_loss: 0.2809 - val_accuracy: 0.8907\n",
      "Epoch 4/20\n",
      "15000/15000 [==============================] - 2s 149us/sample - loss: 0.1849 - accuracy: 0.9403 - val_loss: 0.2901 - val_accuracy: 0.8846\n",
      "Epoch 5/20\n",
      "15000/15000 [==============================] - 2s 134us/sample - loss: 0.1505 - accuracy: 0.9522 - val_loss: 0.2990 - val_accuracy: 0.8818\n",
      "Epoch 6/20\n",
      "15000/15000 [==============================] - 2s 132us/sample - loss: 0.1237 - accuracy: 0.9613 - val_loss: 0.2937 - val_accuracy: 0.8850\n",
      "Epoch 7/20\n",
      "15000/15000 [==============================] - 2s 131us/sample - loss: 0.1019 - accuracy: 0.9696 - val_loss: 0.3059 - val_accuracy: 0.8840\n",
      "Epoch 8/20\n",
      "15000/15000 [==============================] - 2s 125us/sample - loss: 0.0862 - accuracy: 0.9753 - val_loss: 0.3334 - val_accuracy: 0.8788\n",
      "Epoch 9/20\n",
      "15000/15000 [==============================] - 2s 135us/sample - loss: 0.0734 - accuracy: 0.9797 - val_loss: 0.3430 - val_accuracy: 0.8822\n",
      "Epoch 10/20\n",
      "15000/15000 [==============================] - 2s 134us/sample - loss: 0.0596 - accuracy: 0.9843 - val_loss: 0.3781 - val_accuracy: 0.8790\n",
      "Epoch 11/20\n",
      "15000/15000 [==============================] - 2s 142us/sample - loss: 0.0480 - accuracy: 0.9891 - val_loss: 0.3935 - val_accuracy: 0.8760\n",
      "Epoch 12/20\n",
      "15000/15000 [==============================] - 2s 129us/sample - loss: 0.0387 - accuracy: 0.9914 - val_loss: 0.4285 - val_accuracy: 0.8776\n",
      "Epoch 13/20\n",
      "15000/15000 [==============================] - 2s 140us/sample - loss: 0.0322 - accuracy: 0.9934 - val_loss: 0.4503 - val_accuracy: 0.8743\n",
      "Epoch 14/20\n",
      "15000/15000 [==============================] - 2s 135us/sample - loss: 0.0248 - accuracy: 0.9955 - val_loss: 0.4867 - val_accuracy: 0.8711\n",
      "Epoch 15/20\n",
      "15000/15000 [==============================] - 2s 133us/sample - loss: 0.0186 - accuracy: 0.9972 - val_loss: 0.5346 - val_accuracy: 0.8662\n",
      "Epoch 16/20\n",
      "15000/15000 [==============================] - 2s 135us/sample - loss: 0.0172 - accuracy: 0.9972 - val_loss: 0.5551 - val_accuracy: 0.8705\n",
      "Epoch 17/20\n",
      "15000/15000 [==============================] - 2s 140us/sample - loss: 0.0104 - accuracy: 0.9994 - val_loss: 0.6851 - val_accuracy: 0.8557\n",
      "Epoch 18/20\n",
      "15000/15000 [==============================] - 2s 134us/sample - loss: 0.0091 - accuracy: 0.9991 - val_loss: 0.6217 - val_accuracy: 0.8685\n",
      "Epoch 19/20\n",
      "15000/15000 [==============================] - 2s 128us/sample - loss: 0.0088 - accuracy: 0.9987 - val_loss: 0.6609 - val_accuracy: 0.8668\n",
      "Epoch 20/20\n",
      "15000/15000 [==============================] - 2s 109us/sample - loss: 0.0042 - accuracy: 0.9997 - val_loss: 0.7545 - val_accuracy: 0.8553\n"
     ]
    }
   ],
   "source": [
    "history = model.fit(partial_x_train, partial_y_train, epochs=20, batch_size=512, validation_data=(x_val, y_val))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['loss', 'accuracy', 'val_loss', 'val_accuracy'])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "history_dict = history.history\n",
    "history_dict.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3dfZyNdf748de7MUJuYypLDKUbNBiTVAqxJUX37ivdSfdla/OrzUrZqLassknF9s0UbW1lpbSVau1uMkpT7iK5mYihiAjD+/fH55pxjHNmjjlzndv38/E4jznnuq5znbdrxvU+n3tRVYwxxqSuw2IdgDHGmNiyRGCMMSnOEoExxqQ4SwTGGJPiLBEYY0yKs0RgjDEpzhKBqVQikiYi20WkSWUeG0sicryI+NLPuvS5ReQ9ERnoRxwi8oCITKzo+8s47/Ui8lFln9dEjyWCFOfdiIsf+0RkZ8DroDeksqjqXlWtqaprKvPYeCUiH4jIiCDbLxOR70XkkP6Pqeq5qppbCXF1F5FVpc79kKoOjfTcJvlYIkhx3o24pqrWBNYAvQK2HXRDEpEq0Y8yrv0NuDLI9iuBqaq6L7rhGHPoLBGYMonIwyIyXUReEZFtwCAROV1EPhWRLSKyXkTGi0i6d3wVEVERyfReT/X2vyMi20TkfyLS7FCP9fafLyLfiMhWEXlKRP4jIoNDxB1OjDeKyAoR+UlExge8N01EnhSRzSLyLdCjjEv0D+AYETkj4P31gZ7A/3mve4vIQu/ftEZEHijjes8t/jeVF4dXJbPEO++3InK9t70O8E+gSUDp7ijvd/m3gPdfLCKLvGv0oYicGLCvQESGichX3vV+RUQOL+M6BMbVSUTyvPd9JiKnBey7TkRWeTGvFJF+3vYT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mesLXHXVVTz11FN07tyZESNG8OCDDzJu3DjGjBnDd999x+GHH15SHfX4448zYcIEzjzzTLZv3061atUO5WobU/nmzYMzzoCrr3bdM0MsEBU1y5e77qIXXwwhqoWjyderoaqzVPUEVT1OVUd720YEJAFUdaSqHjzZfoIJrB4KrBZSVe677z6ysrLo3r0733//PRs2bAh5nk8++aTkhpyVlUVWVlbJvldffZXs7GzatWvHokWLyp1Qbu7cuVxyySUcccQR1KxZk0svvZR///vfADRr1oy2bdsCZU91DW59hC1bttC5c2cArr76aj7xlszLyspi4MCBTJ06tWQE85lnnsmwYcMYP348W7ZssZHNJvYeecTd/KdMcbN6xrJksG+fGzh2+OHw17/6ttjMoUi+/6FlfHP308UXX8ywYcP4/PPP2blzZ8k3+dzcXAoLC1mwYAHp6elkZmYGnXo6ULDSwnfffcfjjz/O/PnzqVevHoMHDy73PGUVsoqnsAY3jXV5VUOhvP3223zyySfMmDGDhx56iEWLFjF8+HAuuOACZs2aRceOHXn//fc56aSTKnR+YyK2eLGbzXPECLcK1eOPuymHx46NzU140iT4+GN44QVo2DD6nx9Eyk1D7ZeaNWvSpUsXrr322gMaibdu3cpRRx1Feno6c+bMYfXq1WWe5+yzzy5ZoP7rr78mPz8fcFNYH3HEEdSpU4cNGzbwzjvvlLynVq1aQevhzz77bN5880127NjBL7/8whtvvMFZZ511yP+2OnXqUK9evZLSxEsvvUTnzp3Zt28fa9eupWvXrjz66KNs2bKF7du38+2333LKKadw7733kpOTw9KlSw/5M42pNI895m78t90Gjz7qBm099hgELBUbNcXrD3fvDtdcE/3PDyH5SgQx1L9/fy699NIDehANHDiQXr16kZOTQ9u2bcv9ZnzTTTdxzTXXkJWVRdu2benQoQPgVhtr164drVq1OmgK6yFDhnD++efTsGFD5syZU7I9OzubwYMHl5zj+uuvp127dmVWA4Xy4osvMnToUHbs2EHz5s2ZMmUKe/fuZdCgQWzduhVV5a677qJu3bo88MADzJkzh7S0NFq2bFmy2poxUbd2LUyd6m7+xW1oTz3lSg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t/1vx313AsVG9hmXcU6L292dTTBhjTIqzqiFjjElxlgiMMSbFWSIwxpgUZ4nAGGNSnCUCY4xJcZYIjPGIyF45cGbUSpsJU0QyA2e+NCaeVIl1AMbEkZ2q2jbWQRgTbVYiMKYc3nz0Y0XkM+9xvLe9qYh84E2q9oGINPG2Hy1ujYAvvccZ3qnSROQ5b87590Skunf87SKy2DvPtBj9M00Ks0RgzH7VS1UN9Q3Y97OqdgCeBsZ5257GTeedhZv0bby3fTzwsbpJ87JxI1IBWgATVLUVsAW4zNs+HGjnnWeoX/84Y0KxkcXGeERku6rWDLJ9FXCOqq70Jgf7QVXri8gm3LQJe7zt61W1gYgUAo1VdVfAOTJx88a38F7fC6Sr6sMi8i6wHTfL6pvqTbhnTLRYicCY8GiI56GOCWZXwPO97G+juwA391N7YIE3I6YxUWOJwJjw9A34+T/v+X9xs2UCDATmes8/AG4CEJE0Eakd6qQichhwrKrOAX4P1AUOKpUY4yf75mHMftXlwAXM31XV4i6kh4vIPNyXp/7ettuBySJyD1AIXONtvwOYJCLX4b7534Sb+TKYNGCqiNTBzQr7pKpuqbR/kTFhsDYCY8rhtRHkqOqmWMdijB+sasgYY1KclQiMMSbFWYnAGGNSnCUCY4xJcZYIjDEmxVkiMMaYFGeJwBhjUtz/B0A9a59Qj426AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "loss_values = history_dict['loss']\n",
    "val_loss_values = history_dict['val_loss']\n",
    "\n",
    "epochs = range(1, len(loss_values)+1)\n",
    "\n",
    "plt.plot(epochs, loss_values, 'bo', label='Training loss')\n",
    "plt.plot(epochs, val_loss_values, 'r', label='Validation loss')\n",
    "plt.title('Training and Validation loss')\n",
    "plt.xlabel('Epochs')\n",
    "plt.ylabel('Loss')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEWCAYAAAB8LwAVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deZwU1bn/8c8DIsgqm6Agi8YoigyMI2rELRpEoxCXRAnG/aJGXBK9N0b5XY3RLMYYl3i9YqIxYSIxEo16XWKQgMaoDLJDEETQEURAQDaFgef3x6lmmqZ66JneZpjv+/WqV3dXnap+uqannj7nVJ0yd0dERCRVk2IHICIi9ZMShIiIxFKCEBGRWEoQIiISSwlCRERiKUGIiEgsJQjJmJk1NbP1ZtYjl2WLycy+ZGY5P9fbzE4xs8VJr+eb2XGZlK3De/3GzG6u6/oi6exR7AAkf8xsfdLLlsAXwNbo9RXuXl6b7bn7VqB1rss2Bu5+cC62Y2aXAxe4+4lJ2748F9sWSaUEsRtz9+0H6OgX6uXu/vd05c1sD3evKkRsIrui72PxqYmpETOzO8zsT2b2hJmtAy4ws2PM7E0zW2Nmy8zsfjNrFpXfw8zczHpFr8dGy180s3Vm9i8z613bstHy08zsXTNba2YPmNk/zeziNHFnEuMVZrbQzFab2f1J6zY1s1+Z2Sozew8YUsP+GW1m41LmPWhm90TPLzezedHneS/6dZ9uW5VmdmL0vKWZ/SGKbQ5wRMz7Loq2O8fMhkbzDwd+DRwXNd+tTNq3tyWtf2X02VeZ2TNmtm8m+6Y2+zkRj5n93cw+NbOPzey/kt7n/0X75DMzqzCz/eKa88zs9cTfOdqfk6P3+RQYbWYHmdnE6LOsjPZbu6T1e0afcUW0/D4zaxHF3Cep3L5mttHMOqb7vBLD3TU1gglYDJySMu8OYDNwJuHHwl7AkcBRhNrlAcC7wKio/B6AA72i12OBlUAZ0Az4E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ciRs3BheL1kSXgOMGFG3bXbs2JHp06cDcNttt9G6dWtuvPHGHcq4O+5Okybxv4sfe+yxXb7P1VdfXbcAGyjVIESkoG65pTo5JGzcGObn2sKFC+nbty9XXnklpaWlLFu2jJEjR1JWVsZhhx3G7bffvr3soEGDmD59OlVVVey9997cdNNNlJSUcMwxx/DJJ58AMHr0aO69997t5W+66SYGDhzIwQcfzBtvvAHAhg0bOOeccygpKWH48OGUlZVtT17Jbr31Vo488sjt8bk7AO+++y5f/epXKSkpobS0lMWLFwPwk5/8hMMPP5ySkhJuycfOikG+odQAABA5SURBVKEEISIF9cEHtZufrblz53LZZZcxbdo0unXrxs9+9jMqKiqYMWMGr7zyCnPnzt1pnbVr13LCCScwY8YMjjnmGB599NHYbbs7b7/9Nr/4xS+2J5sHHniArl27MmPGDG666SamTZsWu+51113HlClTmDVrFmvXruWll14CYPjw4Xzve99jxowZvPHGG+yzzz4899xzvPjii7z99tvMmDGDG264IUd7p2Z5TRBmNsTM5pvZQjO7KWZ5DzObaGbTzGymmZ2etOyH0XrzzezUfMYpIoXTo0ft5mfrwAMP5Mgjj9z++oknnqC0tJTS0lLmzZsXmyD22msvTjvtNACOOOKI7b/iU5199tk7lXn99dc5//zzASgpKeGwww6LXXfChAkMHDiQkpISJk2axJw5c1i9ejUrV67kzDPPBMLFbS1btuTvf/87l156KXvttRcAHTp0qP2OqIO8JQgzawo8CJwGHAoMN7NDU4qNBp509wHA+cD/ROseGr0+DBgC/E+0PRFp4O68E1q23HFey5Zhfj60atVq+/MFCxZw33338eqrrzJz5kyGDBkSe23Annvuuf1506ZNqaqqit128+bNdyqTaCqqycaNGxk1ahRPP/00M2fO5NJLL90eR9zpqO5elNOI81mDGAgsdPdF7r4ZGAcMSynjQNvoeTtgafR8GDDO3b9w9/eBhdH2RKSBGzECxoyBnj3BLDyOGVP3Dura+Oyzz2jTpg1t27Zl2bJlvPzyyzl/j0GDBvHkk08CMGvWrNgayqZNm2jSpAmdOnVi3bp1jB8/HoD27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NmOnbsSHl5OV26dGH9+vVcc801VFRUYGbceuutnHPOObz00kvcfPPNbN26lU6dOjFhwoSsdrsShIg0eB07dmTgwIG89NJLDBs2jHHjxnHeeedhZrRo0YKnn36atm3bsnLlSo4++miGDh2advC7hx56iJYtWzJz5kxmzpxJaWnp9mV33nknHTp0YOvWrZx88snMnDmTa6+9lnvuuYeJEyfSqVOnHbY1depUHnvsMd566y3cnaOOOooTTjiB9u3bs2DBAp544gkeeeQRvvWtbzF+/HguuOCCHdYfNGgQb775JmbGb37zG+666y5++ctf8uMf/5h27doxa9YsAFavXs2KFSv4j//4DyZPnkzv3r1zMl6TEoSI5FYNv/TzKdHMlEgQiV/t7s7NN9/M5MmTadKkCR999BHLly+na9eusduZPHky1157LQD9+vWjX79+25c9+eSTjBkzhqqqKpYtW8bcuXN3WJ7q9ddf56yzzto+ouzZZ5/Na6+9xtChQ+nduzf9+/cH0g8pXllZyXnnnceyZcvYvHkzvXv3BuDvf//7Dk1q7du357nnnuP444/fXiYXQ4I3+j6IXN8bV0SK4xvf+AYTJkzgnXfeYdOmTdt/+ZeXl7NixQqmTp3K9OnT6dKlS+wQ38niahfvv/8+d999NxMmTGDmzJl8/etf3+V2ahrrLjFUOKQfUvyaa65h1KhRzJo1i4cffnj7+8UN/52PIcEbdYJI3Bt3yRJwr743rpKESMPTunVrTjzxRC699NIdOqfXrl3LPvvsQ7NmzZg4cSJLliypcTvHH3885dFBYPbs2cycORMIQ4W3atWKdu3asXz5cl588cXt67Rp04Z169bFbuuZZ55h48aNbNiwgaeffprjjjsu48+0du1aunULA1k//vjj2+cPHjyYX//619tfr169mmOOOYZJkybx/vvvA7kZErxRJ4hC3htXRPJv+PDhzJgxY/sd3QBGjBhBRUUFZWVllJeXc8ghh9S4jauuuor169fTr18/7rrrLgYODLeiKSkpYcCAARx22GFceumlOwwVPnLkSE477TROOumkHbZVWlrKxRdfzMCBAznqqKO4/PLLGTBgQMaf57bbbuOb3/wmxx133A79G6NHj2b16tX07duXkpIS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0HRa9/ADRz9zvM7CVgPWHE2mc8GqRQpFBUgxDJjqd5nq5MnC+Snm+lum/w64RxsY4ApkYjjIoUjBKESHbOS3r8V/T8DcLoowAjgNej5xOAqwDMrKmZtU23UTNrAuzv7hOB/wL2BnaqxYjkk36RiOzaXrbjjetfcvfEqa7Nzewtwo+t4dG8a4FHzew/gRXAJdH864AxZnYZoaZwFWEk0ThNgbFm1o4wwu6v3H1Nzj6RSAbUByFSR1EfRJm7ryx2LCL5oCYmERGJpRqEiIjEUg1CRERiKUGIiEgsJQgREYmlBCEiIrGUIEREJNb/BwbBoQCUnxmsAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.clf()\n",
    "acc = history_dict['accuracy']\n",
    "val_acc = history_dict['val_accuracy']\n",
    "plt.plot(epochs, acc, 'bo', label='Training acc')\n",
    "plt.plot(epochs, val_acc, 'r', label='Validation acc')\n",
    "plt.title('Training and validation accuracy')\n",
    "plt.xlabel('Epochs')\n",
    "plt.ylabel('Accuracy')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/reuters.npz\n",
      "2113536/2110848 [==============================] - 33s 16us/step\n"
     ]
    }
   ],
   "source": [
    "from tensorflow.keras.datasets import reuters\n",
    "(train_data, train_labels), (test_data, test_labels) = reuters.load_data(num_words=10000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8982"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(train_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2246"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(test_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1,\n",
       " 2,\n",
       " 2,\n",
       " 8,\n",
       " 43,\n",
       " 10,\n",
       " 447,\n",
       " 5,\n",
       " 25,\n",
       " 207,\n",
       " 270,\n",
       " 5,\n",
       " 3095,\n",
       " 111,\n",
       " 16,\n",
       " 369,\n",
       " 186,\n",
       " 90,\n",
       " 67,\n",
       " 7,\n",
       " 89,\n",
       " 5,\n",
       " 19,\n",
       " 102,\n",
       " 6,\n",
       " 19,\n",
       " 124,\n",
       " 15,\n",
       " 90,\n",
       " 67,\n",
       " 84,\n",
       " 22,\n",
       " 482,\n",
       " 26,\n",
       " 7,\n",
       " 48,\n",
       " 4,\n",
       " 49,\n",
       " 8,\n",
       " 864,\n",
       " 39,\n",
       " 209,\n",
       " 154,\n",
       " 6,\n",
       " 151,\n",
       " 6,\n",
       " 83,\n",
       " 11,\n",
       " 15,\n",
       " 22,\n",
       " 155,\n",
       " 11,\n",
       " 15,\n",
       " 7,\n",
       " 48,\n",
       " 9,\n",
       " 4579,\n",
       " 1005,\n",
       " 504,\n",
       " 6,\n",
       " 258,\n",
       " 6,\n",
       " 272,\n",
       " 11,\n",
       " 15,\n",
       " 22,\n",
       " 134,\n",
       " 44,\n",
       " 11,\n",
       " 15,\n",
       " 16,\n",
       " 8,\n",
       " 197,\n",
       " 1245,\n",
       " 90,\n",
       " 67,\n",
       " 52,\n",
       " 29,\n",
       " 209,\n",
       " 30,\n",
       " 32,\n",
       " 132,\n",
       " 6,\n",
       " 109,\n",
       " 15,\n",
       " 17,\n",
       " 12]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_data[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/reuters_word_index.json\n",
      "557056/550378 [==============================] - 8s 15us/step\n"
     ]
    }
   ],
   "source": [
    "word_index = reuters.get_word_index()\n",
    "reverse_word_index = dict([(value, key) for (key, value) in word_index.items()])\n",
    "decoded_newswire = ' '.join([reverse_word_index.get(i - 3, '?') for i in train_data[0]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'? ? ? said as a result of its december acquisition of space co it expects earnings per share in 1987 of 1 15 to 1 30 dlrs per share up from 70 cts in 1986 the company said pretax net should rise to nine to 10 mln dlrs from six mln dlrs in 1986 and rental operation revenues to 19 to 22 mln dlrs from 12 5 mln dlrs it said cash flow per share this year should be 2 50 to three dlrs reuter 3'"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "decoded_newswire"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_train = vectorize_sequences(train_data)\n",
    "x_test = vectorize_sequences(test_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tensorflow.keras.utils import to_categorical\n",
    "\n",
    "one_hot_train_labels = to_categorical(train_labels)\n",
    "ont_hot_test_labels = to_categorical(test_labels)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = models.Sequential()\n",
    "model.add(layers.Dense(64, activation='relu', input_shape=(10000,)))\n",
    "model.add(layers.Dense(64, activation='relu'))\n",
    "model.add(layers.Dense(46, activation='softmax'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "model.compile(optimizer='rmsprop',\n",
    "loss='categorical_crossentropy',\n",
    "metrics=['accuracy'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_val = x_train[:1000]\n",
    "partial_x_train = x_train[1000:]\n",
    "y_val = one_hot_train_labels[:1000]\n",
    "partial_y_train = one_hot_train_labels[1000:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train on 7982 samples, validate on 1000 samples\n",
      "Epoch 1/20\n",
      "7982/7982 [==============================] - 1s 181us/sample - loss: 2.6847 - accuracy: 0.5423 - val_loss: 1.7971 - val_accuracy: 0.6550\n",
      "Epoch 2/20\n",
      "7982/7982 [==============================] - 1s 96us/sample - loss: 1.4580 - accuracy: 0.7078 - val_loss: 1.3408 - val_accuracy: 0.7250\n",
      "Epoch 3/20\n",
      "7982/7982 [==============================] - 1s 93us/sample - loss: 1.0836 - accuracy: 0.7712 - val_loss: 1.1561 - val_accuracy: 0.7620\n",
      "Epoch 4/20\n",
      "7982/7982 [==============================] - 1s 104us/sample - loss: 0.8526 - accuracy: 0.8175 - val_loss: 1.0745 - val_accuracy: 0.7730\n",
      "Epoch 5/20\n",
      "7982/7982 [==============================] - 1s 90us/sample - loss: 0.6834 - accuracy: 0.8545 - val_loss: 0.9808 - val_accuracy: 0.7950\n",
      "Epoch 6/20\n",
      "7982/7982 [==============================] - 1s 107us/sample - loss: 0.5522 - accuracy: 0.8851 - val_loss: 0.9576 - val_accuracy: 0.8030\n",
      "Epoch 7/20\n",
      "7982/7982 [==============================] - 1s 88us/sample - loss: 0.4492 - accuracy: 0.9057 - val_loss: 0.9142 - val_accuracy: 0.8200\n",
      "Epoch 8/20\n",
      "7982/7982 [==============================] - 1s 99us/sample - loss: 0.3666 - accuracy: 0.9217 - val_loss: 0.9113 - val_accuracy: 0.8160\n",
      "Epoch 9/20\n",
      "7982/7982 [==============================] - 1s 104us/sample - loss: 0.3029 - accuracy: 0.9345 - val_loss: 0.9048 - val_accuracy: 0.8230\n",
      "Epoch 10/20\n",
      "7982/7982 [==============================] - 1s 97us/sample - loss: 0.2563 - accuracy: 0.9426 - val_loss: 0.8907 - val_accuracy: 0.8280\n",
      "Epoch 11/20\n",
      "7982/7982 [==============================] - 1s 92us/sample - loss: 0.2192 - accuracy: 0.9498 - val_loss: 0.9326 - val_accuracy: 0.8180\n",
      "Epoch 12/20\n",
      "7982/7982 [==============================] - 1s 93us/sample - loss: 0.1918 - accuracy: 0.9521 - val_loss: 0.9625 - val_accuracy: 0.8150\n",
      "Epoch 13/20\n",
      "7982/7982 [==============================] - 1s 90us/sample - loss: 0.1738 - accuracy: 0.9535 - val_loss: 0.9557 - val_accuracy: 0.8200\n",
      "Epoch 14/20\n",
      "7982/7982 [==============================] - 1s 117us/sample - loss: 0.1548 - accuracy: 0.9565 - val_loss: 1.0029 - val_accuracy: 0.8040\n",
      "Epoch 15/20\n",
      "7982/7982 [==============================] - 1s 110us/sample - loss: 0.1466 - accuracy: 0.9554 - val_loss: 0.9716 - val_accuracy: 0.8210\n",
      "Epoch 16/20\n",
      "7982/7982 [==============================] - 1s 107us/sample - loss: 0.1351 - accuracy: 0.9580 - val_loss: 1.0192 - val_accuracy: 0.8080\n",
      "Epoch 17/20\n",
      "7982/7982 [==============================] - 1s 100us/sample - loss: 0.1331 - accuracy: 0.9569 - val_loss: 1.0222 - val_accuracy: 0.8090\n",
      "Epoch 18/20\n",
      "7982/7982 [==============================] - 1s 93us/sample - loss: 0.1199 - accuracy: 0.9597 - val_loss: 1.0292 - val_accuracy: 0.8120\n",
      "Epoch 19/20\n",
      "7982/7982 [==============================] - 1s 90us/sample - loss: 0.1192 - accuracy: 0.9582 - val_loss: 1.0251 - val_accuracy: 0.8230\n",
      "Epoch 20/20\n",
      "7982/7982 [==============================] - 1s 78us/sample - loss: 0.1143 - accuracy: 0.9584 - val_loss: 1.0863 - val_accuracy: 0.8080\n"
     ]
    }
   ],
   "source": [
    "history = model.fit(partial_x_train,\n",
    "partial_y_train,\n",
    "epochs=20,\n",
    "batch_size=512,\n",
    "validation_data=(x_val, y_val))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deXhU5f3//+cbCIRNQKBV2QJqUcAAMSIWFVy+1n1BrSBuqEVsrVvrTy5r1fqpV92KFPVjpVXaSiq1+tFaxFpbadHaKouAC0VcQCKIAWUTFwLv3x/3CQxhJpmQnJlJ5vW4rnPNmbO+52Ry3nPf5z73MXdHRETyV7NsByAiItmlRCAikueUCERE8pwSgYhInlMiEBHJc0oEIiJ5TolAGpSZNTezTWbWsyGXzSYz28/MGrydtZkda2bLEt4vMbMj0ll2N/b1azO7YXfXr2G7PzWz3zT0diWzWmQ7AMkuM9uU8LYN8CWwNXp/mbuX1WV77r4VaNfQy+YDd+/bENsxs0uB89x9RMK2L22IbUvTpESQ59x9+4k4+sV5qbv/LdXyZtbC3SszEZuIZIaqhqRGUdH/D2b2qJltBM4zs8PM7D9mts7MVpnZZDMriJZvYWZuZkXR+2nR/GfNbKOZ/dvMetd12Wj+CWb2tpmtN7N7zexfZnZRirjTifEyM3vHzD41s8kJ6zY3s3vMbK2ZvQscX8PxudHMplebdr+ZTYzGLzWzxdHneTf6tZ5qW+VmNiIab2Nmj0SxvQkcnGS/70XbfdPMTo2mHwTcBxwRVbutSTi2tySsPz767GvN7Ckz2zudY1MbMzs9imedmb1gZn0T5t1gZivNbIOZ/Tfhsw41s/nR9NVmdle6+5MG4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j7YyP68OJpKI7i0UiZrbJ3dslmb4MONrd34s6B/vI3Tub2RpCtwlboumr3L2LmVUA3d39y4RtFBH6jd8/en89UODuPzWzvwCbCL2sPuVRh3simaISgUh6PMV4qmWS+TJhfCs7rtGdROj76WBgXtQjpkjGKBGIpOechNd/R+MvE3rLBBgDvBSN/x24HMDMmpvZHqk2ambNgB7uPgv4/4COwC6lEpE46ZeHyA6tbecHmP/F3auakLYys1cIP55GR9OuBB42s+uACmBsNP0qYIqZXUL45X85oefLZJoD08ysA6FX2HvcfV2DfSKRNOgagUgtomsEpe6+JtuxiMRBVUMiInlOJQIRkTynEoGISJ5TIhARyXNKBCIieU6JQEQkzykRiIjkuf8fvbF1VQZ3qEIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "loss = history.history['loss']\n",
    "val_loss = history.history['val_loss']\n",
    "epochs = range(1, len(loss) + 1)\n",
    "plt.plot(epochs, loss, 'bo', label='Training loss')\n",
    "plt.plot(epochs, val_loss, 'b', label='Validation loss')\n",
    "plt.title('Training and validation loss')\n",
    "plt.xlabel('Epochs')\n",
    "plt.ylabel('Loss')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/boston_housing.npz\n",
      "57344/57026 [==============================] - 4s 67us/step\n"
     ]
    }
   ],
   "source": [
    "from tensorflow.keras.datasets import boston_housing\n",
    "(train_data, train_targets), (test_data, test_targets) = boston_housing.load_data()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(404, 13)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([15.2, 42.3, 50. , 21.1, 17.7, 18.5, 11.3, 15.6, 15.6, 14.4, 12.1,\n",
       "       17.9, 23.1, 19.9, 15.7,  8.8, 50. , 22.5, 24.1, 27.5, 10.9, 30.8,\n",
       "       32.9, 24. , 18.5, 13.3, 22.9, 34.7, 16.6, 17.5, 22.3, 16.1, 14.9,\n",
       "       23.1, 34.9, 25. , 13.9, 13.1, 20.4, 20. , 15.2, 24.7, 22.2, 16.7,\n",
       "       12.7, 15.6, 18.4, 21. , 30.1, 15.1, 18.7,  9.6, 31.5, 24.8, 19.1,\n",
       "       22. , 14.5, 11. , 32. , 29.4, 20.3, 24.4, 14.6, 19.5, 14.1, 14.3,\n",
       "       15.6, 10.5,  6.3, 19.3, 19.3, 13.4, 36.4, 17.8, 13.5, 16.5,  8.3,\n",
       "       14.3, 16. , 13.4, 28.6, 43.5, 20.2, 22. , 23. , 20.7, 12.5, 48.5,\n",
       "       14.6, 13.4, 23.7, 50. , 21.7, 39.8, 38.7, 22.2, 34.9, 22.5, 31.1,\n",
       "       28.7, 46. , 41.7, 21. , 26.6, 15. , 24.4, 13.3, 21.2, 11.7, 21.7,\n",
       "       19.4, 50. , 22.8, 19.7, 24.7, 36.2, 14.2, 18.9, 18.3, 20.6, 24.6,\n",
       "       18.2,  8.7, 44. , 10.4, 13.2, 21.2, 37. , 30.7, 22.9, 20. , 19.3,\n",
       "       31.7, 32. , 23.1, 18.8, 10.9, 50. , 19.6,  5. , 14.4, 19.8, 13.8,\n",
       "       19.6, 23.9, 24.5, 25. , 19.9, 17.2, 24.6, 13.5, 26.6, 21.4, 11.9,\n",
       "       22.6, 19.6,  8.5, 23.7, 23.1, 22.4, 20.5, 23.6, 18.4, 35.2, 23.1,\n",
       "       27.9, 20.6, 23.7, 28. , 13.6, 27.1, 23.6, 20.6, 18.2, 21.7, 17.1,\n",
       "        8.4, 25.3, 13.8, 22.2, 18.4, 20.7, 31.6, 30.5, 20.3,  8.8, 19.2,\n",
       "       19.4, 23.1, 23. , 14.8, 48.8, 22.6, 33.4, 21.1, 13.6, 32.2, 13.1,\n",
       "       23.4, 18.9, 23.9, 11.8, 23.3, 22.8, 19.6, 16.7, 13.4, 22.2, 20.4,\n",
       "       21.8, 26.4, 14.9, 24.1, 23.8, 12.3, 29.1, 21. , 19.5, 23.3, 23.8,\n",
       "       17.8, 11.5, 21.7, 19.9, 25. , 33.4, 28.5, 21.4, 24.3, 27.5, 33.1,\n",
       "       16.2, 23.3, 48.3, 22.9, 22.8, 13.1, 12.7, 22.6, 15. , 15.3, 10.5,\n",
       "       24. , 18.5, 21.7, 19.5, 33.2, 23.2,  5. , 19.1, 12.7, 22.3, 10.2,\n",
       "       13.9, 16.3, 17. , 20.1, 29.9, 17.2, 37.3, 45.4, 17.8, 23.2, 29. ,\n",
       "       22. , 18. , 17.4, 34.6, 20.1, 25. , 15.6, 24.8, 28.2, 21.2, 21.4,\n",
       "       23.8, 31. , 26.2, 17.4, 37.9, 17.5, 20. ,  8.3, 23.9,  8.4, 13.8,\n",
       "        7.2, 11.7, 17.1, 21.6, 50. , 16.1, 20.4, 20.6, 21.4, 20.6, 36.5,\n",
       "        8.5, 24.8, 10.8, 21.9, 17.3, 18.9, 36.2, 14.9, 18.2, 33.3, 21.8,\n",
       "       19.7, 31.6, 24.8, 19.4, 22.8,  7.5, 44.8, 16.8, 18.7, 50. , 50. ,\n",
       "       19.5, 20.1, 50. , 17.2, 20.8, 19.3, 41.3, 20.4, 20.5, 13.8, 16.5,\n",
       "       23.9, 20.6, 31.5, 23.3, 16.8, 14. , 33.8, 36.1, 12.8, 18.3, 18.7,\n",
       "       19.1, 29. , 30.1, 50. , 50. , 22. , 11.9, 37.6, 50. , 22.7, 20.8,\n",
       "       23.5, 27.9, 50. , 19.3, 23.9, 22.6, 15.2, 21.7, 19.2, 43.8, 20.3,\n",
       "       33.2, 19.9, 22.5, 32.7, 22. , 17.1, 19. , 15. , 16.1, 25.1, 23.7,\n",
       "       28.7, 37.2, 22.6, 16.4, 25. , 29.8, 22.1, 17.4, 18.1, 30.3, 17.5,\n",
       "       24.7, 12.6, 26.5, 28.7, 13.3, 10.4, 24.4, 23. , 20. , 17.8,  7. ,\n",
       "       11.8, 24.4, 13.8, 19.4, 25.2, 19.4, 19.4, 29.1])"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_targets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "mean = train_data.mean(axis=0)\n",
    "train_data -= mean\n",
    "std = train_data.std(axis=0)\n",
    "train_data /= std"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def build_model():\n",
    "    model = models.Sequential()\n",
    "    model.add(layers.Dense(64, activation='relu', input_shape=(train_data.shape[1],)))\n",
    "    model.add(layers.Dense(64, activation='relu'))\n",
    "    model.add(layers.Dense(1))\n",
    "    model.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])\n",
    "    return model"
   ]
  }
 ],
 "metadata": {
  "hide_input": false,
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3-final"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}